{include file="public/header" /}



<div class="page">

  <div class="fixed-empty"></div>
  <form id="adv_form" enctype="multipart/form-data" method="post" name="advForm">
    <table class="ds-default-table">
      <tbody>
        <tr class="noborder">
          <td class="required w120"><label class="validation" for="adv_name">{$Think.lang.adv_name}:</label></td>
          <td class="vatop rowform"><input type="text" name="adv_name" id="adv_name" class="txt" value="{$adv.adv_title|default=''}"></td>
          <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
            <td class="required"><label>{$Think.lang.adv_ap_id}:</label></td>
            <td class="vatop rowform">
                <select name="ap_id" id="ap_id">
                    {foreach name="ap_list" item="ap" key="ap_k" }
                    <option value='{$ap.ap_id}' {if condition="$Request.param.ap_id eq $ap.ap_id || $adv.ap_id eq $ap.ap_id"}selected{/if}>{$ap.ap_name}[{$ap.ap_width}X{$ap.ap_height}]</option>
                    {/foreach}
                </select>
            </td>
          <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
            <td class="required"><label for="adv_startdate">{$Think.lang.ds_start_time}:</label></td>
            <td class="vatop rowform"><input type="text" name="adv_startdate" id="adv_startdate" class="txt date" value="{:date('Y-m-d',$adv.adv_startdate)}"></td>
            <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
            <td class="required"><label for="adv_startdate">{$Think.lang.adv_sort}:</label></td>
            <td class="vatop rowform"><input type="text" name="adv_sort" id="adv_sort" class="txt" value="{$adv.adv_sort|default='0'}">
            </td>
            <td class="vatop tips">{$Think.lang.adv_sort_role}</td>
        </tr>
        <tr class="noborder">
            <td class="required"><label for="adv_startdate">{$Think.lang.adv_enabled}:</label></td>
            <td class="vatop rowform">
                <div class="onoff">
                    <label for="adv_enabled1" class="cb-enable {if condition="$adv.adv_enabled eq 1"}selected{/if}">{$Think.lang.ds_open}</label>
                    <label for="adv_enabled0" class="cb-disable {if condition="$adv.adv_enabled eq 0"}selected{/if}">{$Think.lang.ds_close}</label>
                    <input id="adv_enabled1" name="adv_enabled" value="1" type="radio" {if condition="$adv.adv_enabled eq 1"} checked="checked"{/if}>
                    <input id="adv_enabled0" name="adv_enabled" value="0" type="radio" {if condition="$adv.adv_enabled eq 0"} checked="checked"{/if}>
                </div>
            </td>
            <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
            <td class="required"><label for="adv_enddate">{$Think.lang.ds_end_time}:</label></td>
            <td class="vatop rowform"><input type="text" name="adv_enddate" id="adv_enddate" class="txt date" value="{:date('Y-m-d',$adv.adv_enddate)}"></td>
            <td class="vatop tips"></td>
        </tr>
        <tr id="adv_code" class="noborder">
            <input type="hidden" name="mark" value="0">
            <td class="required"><label for="file_adv_code">{$Think.lang.adv_img_upload}:</label></td>
            <td class="vatop rowform">
                {notempty name="$adv.adv_code"}
                <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
                    <div class="type-file-preview"><img src="{$Think.BASE_SITE_ROOT}/uploads/{$Think.ATTACH_ADV}/{$adv.adv_code|default=''}"></div>
                </span>
                {/notempty}
                <span class="type-file-box">
                    <input type='text' name='textfield' id='textfield1' class='type-file-text' />
                    <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
                    <input name="adv_code" id="file_adv_code" type="file" class="type-file-file" id="site_logo" size="30" hidefocus="true">
                </span>
            </td>
          <td class="vatop tips">{$Think.lang.adv_edit_support}gif,jpg,jpeg,png </td>
        </tr>
        <tr class="noborder" >
            <td class="required"><label for="adv_bgcolor">{$Think.lang.adv_bgcolor}:</label></td>
            <td class="vatop rowform">
                <input id="adv_bgcolor"  type="text"  name="adv_bgcolor" value="{$adv.adv_bgcolor|default='#fff'}"/>
            </td>
        </tr>
        <tr id="adv_link" class="noborder">
            <td class="required"><label for="adv_link">{$Think.lang.adv_link}:</label></td>
            <td class="vatop rowform"><input type="text" id="adv_link" name="adv_link" value="{$adv.adv_link|default=''}" class="txt"></td>
            <td class="vatop tips">{$Think.lang.adv_link_donotadd}</td>
        </tr>
      </tbody>
      <tfoot>
        <tr class="tfoot">
            <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<link href="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.css" rel="stylesheet" type="text/css">
<script src="{$Think.PLUGINS_SITE_ROOT}/colorpicker/evol.colorpicker.min.js"></script>
<script type="text/javascript">
$(function(){
    $('#adv_startdate').datepicker({dateFormat: 'yy-mm-dd'});
    $('#adv_enddate').datepicker({dateFormat: 'yy-mm-dd'});
    $('#adv_bgcolor').colorpicker({showOn: 'both'});
        $("#file_adv_code").change(function () {
            $("#textfield1").val($("#file_adv_code").val());
        });
});
</script>

<script>
    //按钮先执行验证再提交表单
    $(function(){
        $('#adv_form').validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules : {
                adv_name : {
                    required : true
                }
            },
            messages : {
                adv_name : {
                    required : '{$Think.lang.ap_can_not_null}'
                }

            }
        });
    });
</script>